<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
table{
	border:5px double red;
}
th,td{
	border-right:1px dotted red;
	border-bottom:1px dotted red;
	padding: 10px;
}
</style>
</head>
<body>
<h1>JSTL标签库测试</h1>
<c:set var="kc" value="<b style='color:red'>Jsp动态Web项目</b>开发实战"></c:set>
<c:out value="${kc}"></c:out><br>
<c:out value="${kc}" escapeXml="false"></c:out><br>
<c:out value="${param.kc}" default="没有kc参数时的默认值"></c:out><br>

<c:set var="name" value="张三" scope="page"></c:set>
<c:set var="name" value="李四" scope="request"></c:set>
<c:set var="name" value="王五" scope="session"></c:set>
<c:set var="name" value="杨柳" scope="application"></c:set>
\${pageScope.name}=${pageScope.name}<br>
\${requestScope.name}=${requestScope.name}<br>
\${sessionScope.name}=${sessionScope.name}<br>
\${applicationScope.name}=${applicationScope.name}<br>
<c:set var="name" value="朝气" ></c:set>
\${name}=${name}<br>

<c:remove var="name" scope="page"/>
\${name}=${name}<br>
<c:remove var="name"/>
\${name}=${name}<br>

number=${param.number}，
<c:if test="${param.number%2==0}">偶数</c:if>
<c:if test="${param.number%2!=0}">奇数</c:if><br>

<table cellspacing='0'>
	<tr><th>序号</th><th>数据</th><th>数据的平方</th><tr>
<c:forEach items="7,3,5,1,2,8,6,9,4" var="it" varStatus="s" begin="2" end="6" step='2'>
	<tr><td>${s.count}</td><td>${it}</td><td>${it*it}</td><tr>
</c:forEach>
</table>

<c:set var="names" value="张三,李四;王五、杨柳"></c:set>
<c:forEach items="${names}" var="it" varStatus="s">
	<p>${s.count}、${it}</p>
</c:forEach>


<c:forTokens items="  ${names}" delims=",;、" var="it" varStatus="s">
	<p>${s.count}、${it}</p>
</c:forTokens>

<c:set value='   How are you?   |  I\'m fine, thank you.   |  And you?   ' var="hello"></c:set>
<c:set var="hi" value="${fn:split(hello,'|')}"></c:set>
<c:forEach items="${hi}" var="it" varStatus="s">
	<p>${s.count}、${fn:trim(it)} [${fn:length(fn:trim(it))}]</p>
</c:forEach>
</body>
</html>